<template>
  <div>
    <h1>{{ msg }}</h1>
    <button @click="fn">点击反转字符串,同时转大写</button>
    <button @click="fun">点击反转字符串,同时转小写</button>
  </div>
</template>
<script>
function reverse(str) {
  return str.split('').reverse().join('')
}
export default {
  data() {
    return {
      msg: 'hello world',
    }
  },
  methods: {
    fn() {
      this.msg = reverse(this.msg).toUpperCase()
    },
    fun() {
      this.msg = reverse(this.msg).toLowerCase()
    },
  },
}
</script>
